import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;

import java.io.IOException;

public class WordCountReducer extends Reducer<IntWritable, IntWritable,IntWritable, IntWritable> {
    private IntWritable i = new IntWritable(1);

    @Override
    protected void reduce(IntWritable key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        for (IntWritable value : values) {
            context.write(i,key);
            System.out.println(i+"\t"+key);
            i = new IntWritable(i.get()+1);
        }
    }
}
